package pers.amos.eshop.one.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.amos.eshop.one.service.EshopProductInventoryService;
import pers.amos.eshop.one.service.EshopProductPriceService;

/**
 * @author amos wong
 * @create 2020-12-18 3:39 下午
 */
@RestController
@RequestMapping("/one")
public class EshopOneServiceController {

    @Qualifier("pers.amos.eshop.one.service.EshopProductInventoryService")
    @Autowired
    private EshopProductInventoryService inventoryService;

    @Qualifier("pers.amos.eshop.one.service.EshopProductPriceService")
    @Autowired
    private EshopProductPriceService productPriceService;

    @GetMapping("/findPriceByProductId")
    public String findProductPriceByProductId(Long productId) {
        return productPriceService.findByProductId(productId);
    }

    @GetMapping("/findInventoryByProductId")
    public String findProductInventoryByProductId(Long productId) {
        return inventoryService.findByProductId(productId);
    }

}
